/**
 * 
 */
package com.kingcore.note;

import java.awt.BorderLayout;
import java.util.Date;

import javax.swing.DefaultCellEditor;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;

import com.sunking.swing.JDatePicker;
import com.sunking.swing.OpenSwingUtil;

/**
 * @author Zeven
 *
 */
public class OpenSwingTest {


    /**
     * 测试JDatePicker
     */
    public static void main(String args[]){

            JFrame f = OpenSwingUtil.createDemoFrame("JDatePicker Demo");
            JPanel c = new JPanel();
            c.add(new JLabel("From:"));
            JDatePicker datePickerFrom = new JDatePicker(JDatePicker.
                STYLE_CN_DATETIME);
            c.add(datePickerFrom);
            c.add(new JLabel("To:"));
            Date d = new Date();
            d.setTime(d.getTime() + 10000000000L);
            JDatePicker datePickerTo = new JDatePicker(JDatePicker.
                STYLE_CN_DATE, d);
            datePickerTo.setEditable(false);
            c.add(datePickerTo);
            f.getContentPane().add(c, BorderLayout.NORTH);

            f.getContentPane().add(new JDatePicker(), BorderLayout.SOUTH);

            final JTable table = new JTable(20, 10);
            JComboBox editor = new JDatePicker();
            editor.setBorder(null);
            table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
            table.setDefaultEditor(Object.class, new DefaultCellEditor(editor));
            JScrollPane sp = new JScrollPane(table);
            f.getContentPane().add(sp, BorderLayout.CENTER);

//            f.setSize(600, 400);
            f.setVisible(true);
    }

}
